//
//  DSGuanZhuTabController.m
//  budejie
//
//  Created by tangQiang on 8/24/16.
//  Copyright © 2016 Dason. All rights reserved.
//

#import "DSGuanZhuTabController.h"
#import "DSGZSearchTabController.h"
#import "DSFriendsRecommentViewController.h"

@implementation DSGuanZhuTabController


#pragma mark - view did load
- (void)viewDidLoad {
    
    // 设置 NavgationBar 上的所有参数
    [self setNavgationBarAllAttributes];
    
}

#pragma mark - 设置 NavgationBar 上的所有参数
- (void)setNavgationBarAllAttributes {
    // title
    self.title = @"关注";
    
    // 返回
    self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:nil];
    
    // left item
    UIButton *leftBtn = [[UIButton alloc]init];
    [leftBtn sizeToFit];
    [leftBtn setImage:[UIImage imageNamed:@"friendsRecommentIcon"] forState:UIControlStateNormal];
    [leftBtn setImage:[UIImage imageNamed:@"friendsRecommentIcon-click"] forState:UIControlStateHighlighted];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:leftBtn];
    
    // left item 的点击事件
    [leftBtn addTarget:self action:@selector(clickLeftItem) forControlEvents:UIControlEventTouchUpInside];
    
    // right item : 缺少图片暂时用系统的
//    UIButton *rightBtn = [[UIButton alloc]init];
    //self.navigationItem.rightBarButtonItem
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self action:@selector(clickRightItem)];
}

#pragma mark - left item 点击方法的实现 : 创建 friendsRecommentVc
- (void)clickLeftItem {
    DSFriendsRecommentViewController *friendsRecommentVc = [[DSFriendsRecommentViewController alloc]init];
    
    //[self.tabBarController hidesBottomBarWhenPushed];
    
    [self.navigationController pushViewController:friendsRecommentVc animated:YES];
}

#pragma mark - right item 点击方法的实现 : GZSearchTabVc
- (void)clickRightItem {
    
    DSGZSearchTabController *GZSearchTabVc = [[DSGZSearchTabController alloc]initWithStyle:UITableViewStylePlain];
    
    GZSearchTabVc.tableView.backgroundColor = [UIColor colorWithRed:arc4random() % 266 / 255.0 green:arc4random() % 266 / 255.0 blue:arc4random() % 266 / 255.0 alpha:1];
    
    [self.navigationController pushViewController:GZSearchTabVc animated:YES];
    
    
}
@end
